package com.geper.pattern.Prototype;

import com.alibaba.fastjson.JSON;
import lombok.Data;
import com.alibaba.fastjson.JSONObject;

/**
 * @author: lsy
 * @date: 2020-03-01 13:34
 * @description: USer
 */
@Data
public class User {

    private String name;

    private Integer age;

    private String sex;

    public User deepClone(){
        JSON o = (JSON)JSONObject.toJSON(this);
        User user = JSONObject.toJavaObject(o, User.class);
        return user;
    }
}
